import { TaskWork } from "../model/TaskModel";
import http from "../utils/Http";

/**
 * 获取全部流程
 */
export const getFlowList = () => {
  return http<TaskWork[]>({
    method: 'post',
    url: '/task/getFlowList',
  })
}

/**
 * 保存流程数据
 */
export const saveFlowData = (taskWork: TaskWork) => {
  return http<TaskWork>({
    method: 'post',
    url: '/task/saveFlowData',
    data: taskWork
  })
}

/**
 * 获取流程数据
 */
export const getFlowData = (taskId:string) => {
  return http<TaskWork>({
    method: 'post',
    url: '/task/getFlowData',
    data: {
      taskId: taskId
    }
  })
}

/**
 * 获取分支列表
 */
export const getBranchList = (taskId:string) => {
  return http<string[]>({
    method: 'post',
    url: '/task/branchList',
    data: {
      taskId: taskId
    }
  })
}

/**
 * 删除流程
 */
export const deleteFlow = (taskId:string) => {
  return http({
    method: 'post',
    url: '/task/deleteFlow',
    data: {
      taskId: taskId
    }
  })
}